<template>
  <div class="personalPage">
    <div class="personalTop">
      <div class="personalInfo" @click="goPersonalInfo">
        <div class="imgInfo">
          <div class="imgBox">
            <img :src="baseUrl" alt="" width="100%"
                 height="100%"
            >
          </div>
          <div class="infoMess">
            <p>{{ userInfo.userName }}</p>
            Lv{{ userInfo.userexper }} {{ nameDec }} | 杠值 999
          </div>
        </div>
        <i class="el-icon-arrow-right" />
      </div>
      <div class="personalMessage" @click="getMessage">
        <div class="messageTop">
          <p>消息提醒</p>
          <span>查看全部消息<i class="el-icon-arrow-right" /></span>
        </div>
        点赞信息、系统推送全在这哦~
      </div>
    </div>
    <div class="personalBottom">
      <div class="personalList">
        <div v-for="(item,index) in personalList" :key="index" class="listItem"
             @click="goPersonalMes(item.id)"
        >
          <svg-icon :icon-class="item.icon" />
          <p>{{ item.name }}</p>
        </div>
      </div>
      <div class="barCode">
        <p style="flex: 0 0 80px;">
          项目地址：
        </p>
        <span style="font-size:14px">git@gitee.com:Gitfubobo/AllPeopleBar-web.git</span>
        <!-- <i class="el-icon-arrow-right" /> -->
      </div>
      <div class="wx">
        作者微信：ff1872008
      </div>
    </div>
  </div>
</template>
<script>
export default {
  data() {
    return {
      userInfo: null,
      personalList: [
        { id: 1, name: '我的杠题', icon: 'mySubject' },
        { id: 2, name: '我的收藏', icon: 'collection' },
        { id: 3, name: '我杠过的', icon: 'message' },
        { id: 4, name: '我赞过的', icon: 'like' }
      ],
      baseUrl: ''
    };
  },
  computed: {
    nameDec() {
      let flag;
      switch (this.userInfo.exper) {
      case 1:
        flag = '杠师';
        break;
      case 2:
        flag = '杠尊';
        break;
      case 3:
        flag = '杠王';
        break;
      case 4:
        flag = '杠圣';
        break;
      case 5:
        flag = '杠神';
        break;
      default:
        flag = '无极';
        break;
      }
      return flag;
    }
  },
  created() {
    this.userInfo = this.$store.getters.userInfo;
    this.baseUrl = process.env.VUE_APP_DEV_TARGET + this.userInfo.userImg;
  },
  methods: {
    getMessage() {
      console.log('得到信息');
    },
    goPersonalInfo() {
      this.$router.push({ name: 'personalInfo' });
    },
    goPersonalMes(item) {
      this.$router.push({ name: 'personalMessage', params: { id: item } });
    }
  }
};
</script>
<style lang="scss">
.el-progress-bar__outer{
  background: #F56C6C;
}
</style>
<style lang="scss" scoped>
.personalPage{
  width: 100%;
  height: 100%;
  position: relative;
  overflow: hidden;
  .personalTop{
    width: 100%;
    height: 140px;
    background:  linear-gradient(to left top,#5fafff,#1f8fff);
    .personalInfo{
      width: 100%;
      height: 100px;
      color: #F2F6FC;
      display: flex;
      align-items: center;
      justify-content: center;
      .imgInfo{
        width: 85%;
        height: 80%;
        display: flex;
        align-items: center;
        .imgBox{
          flex: 0 0 80px;
          width: 80px;
          height: 80px;
          border-radius: 100%;
          overflow: hidden;
        }
        .infoMess{
          flex: 1;
          height: 50px;
          margin-left: 10px;
          font-size: 14px;
          color: #fff;
          p{
            font-size: 18px;
            font-weight: bold;
            line-height: 32px;
          }
        }
      }
    }
    .personalMessage{
      position: absolute;
      left: 50%;
      top: 100px;
      box-sizing: border-box;
      padding: 10px;
      transform: translate(-50%,0);
      z-index: 999;
      width: 90%;
      height: 80px;
      background: #fff;
      font-size: 14px;
      color: #5e5e5e;
      border-radius: 10px;
      box-shadow: 1px 1px 5px #a3a3a3;
      .messageTop{
        width: 100%;
        height: 60%;
        display: flex;
        justify-content: space-between;;
        p{
          color: #303133;
          font-size: 16px;
          font-weight: bold;
        }
        span{
          color: #909399;
          font-size: 12px;
        }
      }
    }
  }
  .personalBottom{
    width: 100%;
    height: 235px;
    background: #fff;
    overflow: hidden;
    .personalList{
      width: 90%;
      height: 50px;
      margin: 60px auto;
      margin-bottom: 20px;
      display: flex;
      justify-content: center;
      .listItem{
        width: 18%;
        height: 100%;
        margin-right: 20px;
        text-align: center;
        font-size: 32px;
        p{
          font-size: 14px;
          color: #5e5e5e;
        }
      }
      .listItem:last-child{
        margin-right: 0px;
      }
    }
    .barCode{
      margin: 0 auto;
      width: 90%;
      height: 50px;
      border: 1px solid #DCDFE6;
      border-left: none;
      border-right: none;
      box-sizing: border-box;
      display: flex;
      justify-content: space-between;
      align-items: center;
      font-size: 16px;
      color: #5e5e5e;
    }
    .wx{
      width: 90%;
      height: 50px;
      margin: 0 auto;
      display: flex;
      align-items: center;
      font-size: 16px;
      color: #5e5e5e;
    }
  }
}
</style>
